package ru.eas.tetris.tetromino;

/**
 * @author aesipov
 */
public class StraightTetromino implements RotatableTetromino
{
    private static final boolean[][] NORTH_SOUTH = { { true, true, true, true } };
    private static final boolean[][] WEST_EAST   = { { true }, { true }, { true }, { true } };

    private boolean[][] state = NORTH_SOUTH;

    @Override
    public void rotateRight()
    {
        rotate();
    }

    @Override
    public void rotateLeft()
    {
        rotate();
    }

    private void rotate() {
        state = (state == NORTH_SOUTH) ? WEST_EAST : NORTH_SOUTH;
    }

    @Override
    public int getWidth()
    {
        return state.length;
    }

    @Override
    public int getHeight()
    {
        return state[0].length;
    }

    @Override
    public boolean isSquare(int x,
                            int y)
    {
        return state[x][y];
    }
}
